<?php echo $this->render('link/header.phtml') ?>
<?php $gridId=uniqid(); ?>
//常用变量初始化

var module="site";
var gridTitle="添加客户";
var dataId="site_id";
Ext.form.Field.prototype.msgTarget = 'side';


industry_combo_store.load();



var industry_combo=new Ext.form.ComboBox({
										width:280,
										fieldLabel:'选择行业',
										store:industry_combo_store,										
        								displayField:'industry_name',
        								valueField :'industry_id',
										hiddenName:"client_industry",
        								typeAhead:true,
        								mode:'local',
        								triggerAction:'all',                                        
        								emptyText:'请选择...',
        								selectOnFocus:true,
                                        queryParam:'client_host',                                                   
                                        //hideTrigger: true, //隐藏下拉箭头   
										loadingText: '正在加载...',
                                        pageSize:8,
                                        minChars:1,
                                        queryDelay:300,   
                                        mode :'remote',  
                                        resizable:true, 
                                        listeners:{
                                        	select:function(){                                        	
                                        	}
                                        }
										 });                                           
 
                                                                                
var keyword_add=new Ext.FormPanel({
	frame:true,
    title:gridTitle,
    labelWidth:60,
    //width:800,
    autoWidht:true,
    autoHeight:true,
    renderTo:'grid_<?=$gridId?>',
    bodyStyle:'padding:0 0 0 0;',    
    items:[industry_combo,{
    	xtype:'textfield',
        fieldLabel:'域名',
        name:'client_host',
        allowBlank:false,
        width:250
        },{
        xtype:'textfield',
        fieldLabel:'公司名称',
        name:'client_company',
        allowBlank:false,
        width:250
        }       
    ],
    buttons:[
    {
    id:'submit',
    text:'提交',
    type:'submit',
    iconCls:'icn-control',
    handler:function(){
    if(keyword_add.getForm().isValid()){
    keyword_add.getForm().submit({
    waitTitle:'提示',
    waitMsg:'请稍等',
    url:baseUrl+"/link/serverclient/type/add",
    success:function(form,action){
    	var _message=Ext.util.JSON.decode(action.response.responseText);
		Ext.MessageBox.alert('提示',_message.msg,function(){
       	Ext.getCmp('content').getActiveTab().getUpdater().refresh();
        });
    },
    failure:function(form,action){
    	var _message=Ext.util.JSON.decode(action.response.responseText);
        Ext.MessageBox.alert('提示',_message.msg);
    }
    });
    }   
    }},{
    text:'退出',
    handler:function(){
    //console.dir(Ext.getCmp('content').getActiveTab().getUpdater());
    Ext.getCmp('content').remove(Ext.getCmp('content').getActiveTab());
    //Ext.getCmp('content').getActiveTab().remove();
    }
    }
    ]
});



});
</script>
<body style="width:98%;height:100%">
<div id='grid_<?=$gridId?>'></div>
</body>
</html>
